/*
 * @Author: ReinerLau lk850593913@gmail.com
 * @Date: 2023-01-12 17:27:40
 * @LastEditors: ReinerLau lk850593913@gmail.com
 * @LastEditTime: 2023-01-12 17:29:17
 * @FilePath: \v2.0.0\cypress\e2e\patroling\patroling_init.cy.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
describe("围界车 - 初始化", () => {
  beforeEach(() => {
    const username = "admin";
    const password = "123456";
    cy.login(username, password);
  });

  it("进入操控端", () => {
    cy.visit("/");
    cy.getByData("sidebar-menu").contains("围界车").click();
    cy.contains("操控端").click();
    cy.getByData("patroling-home").should("exist");
  });

  it("选择车辆", () => {
    cy.intercept(
      "POST",
      "/api/robot-archives/v1/findByRobotTypeAndCompany/patroling*"
    ).as("getAllCar");

    cy.visit("/patroling/release");

    cy.wait("@getAllCar")
      .its("response.body.data.length")
      .should("be.greaterThan", 0);

    cy.getByData("patroling-car-switch").find("svg").eq(0).click();

    cy.getByData("patroling-top").should("exist");
  });
});
